import request from '@/utils/request'

export function getDevices(params) {
  return request({
    url: '/mgr/devices',
    method: 'get',
    params
  })
}

export function getDevice(id) {
  return request({
    url: '/mgr/devices/' + id,
    method: 'get'
  })
}

export function addDevices(array) {
  return request({
    url: '/mgr/devices',
    method: 'post',
    data: array
  })
}

export function editDevice(id, form) {
  return request({
    url: '/mgr/devices/' + id,
    method: 'put',
    data: form
  })
}

export function deleteDevices(ids) {
  return request({
    url: '/mgr/devices',
    method: 'delete',
    data: ids
  })
}

export function getKey(params) {
  return request({
    url: '/mgr/key',
    method: 'get',
    params
  })
}

export function addKey(array) {
  return request({
    url: '/mgr/key',
    method: 'post',
    data: array
  })
}

export function getEvent(params) {
  return request({
    url: '/mgr/event',
    method: 'get',
    params: params
  })
}
